<template>
	<el-config-provider :locale="locale" :button="{ autoInsertSpace: false }">
		<router-view v-if="isRefresh"></router-view>
	</el-config-provider>
</template>

<script>
import colorTool from "@/utils/color";
import languageService from "@/api/sys/languageService";
import zh from "element-plus/es/locale/lang/zh-cn";
import en from "element-plus/es/locale/lang/en";
import ja from "element-plus/es/locale/lang/ja";
export default {
	name: "App",
	data: () => ({
		isRefresh: true,
	}),
	computed: {
		locale() {
			switch (this.$store.state.global.language) {
				case "zh":
					return zh;
				case "en":
					return en;
				case "ja":
					return ja;
			}

			return zh;
		},
	},
	created() {
		//设置主题颜色
		const app_color =
			this.$TOOL.data.get("APP_COLOR") || this.$CONFIG.COLOR;
		if (app_color) {
			colorTool.setAppColors(app_color);
		}
		this.$cookies.set("x-domain", window.location.hostname, -1);
		languageService.getLanguageMap().then((data) => {
			this.$store.commit("updateLanguageMap", data);
		});
	},
	provide() {
		return {
			refresh: this.refresh,
		};
	},
	methods: {
		refresh() {
			this.isRefresh = false;
			this.$nextTick(() => {
				this.isRefresh = true;
			});
		},
	},
};
</script>

<style lang="scss">
@import "@/style/style.scss";
@import "@/style/theme/dark.scss";
@import "@/style/theme/white.scss";
@import url('./assets/fonts/iconfont.css');
*{
	font-family: 'pingfang';
}
.pointer{
	cursor: pointer;
}
.file{
	cursor: pointer;
	color:var(--el-color-primary);
}
.text-bold{
	font-weight: 800;
}
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f5f7fa;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #c0c4cc;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #909399;
}

::-webkit-scrollbar-corner {
  background: #f5f7fa;
}
</style>
